package com.hngates.architecture.service.impl;

import com.hngates.architecture.domain.ArcLabourCompany;
import com.hngates.architecture.mapper.ArcLabourCompanyMapper;
import com.hngates.architecture.service.IArcLabourCompanyService;
import com.hngates.common.core.text.Convert;
import com.hngates.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 施工单位Service业务层处理
 *
 * @author jwhe
 * @date 2022-07-04
 */
@Service
public class ArcLabourCompanyServiceImpl implements IArcLabourCompanyService {
    @Autowired
    private ArcLabourCompanyMapper arcLabourCompanyMapper;

    /**
     * 查询施工单位
     *
     * @param id 施工单位主键
     * @return 施工单位
     */
    @Override
    public ArcLabourCompany selectArcLabourCompanyById(Long id) {
        return arcLabourCompanyMapper.selectArcLabourCompanyById(id);
    }

    /**
     * 查询施工单位列表
     *
     * @param arcLabourCompany 施工单位
     * @return 施工单位
     */
    @Override
    public List<ArcLabourCompany> selectArcLabourCompanyList(ArcLabourCompany arcLabourCompany) {
        return arcLabourCompanyMapper.selectArcLabourCompanyList(arcLabourCompany);
    }

    /**
     * 新增施工单位
     *
     * @param arcLabourCompany 施工单位
     * @return 结果
     */
    @Override
    public int insertArcLabourCompany(ArcLabourCompany arcLabourCompany) {
        arcLabourCompany.setCreateTime(DateUtils.getNowDate());
        return arcLabourCompanyMapper.insertArcLabourCompany(arcLabourCompany);
    }

    /**
     * 修改施工单位
     *
     * @param arcLabourCompany 施工单位
     * @return 结果
     */
    @Override
    public int updateArcLabourCompany(ArcLabourCompany arcLabourCompany) {
        arcLabourCompany.setUpdateTime(DateUtils.getNowDate());
        return arcLabourCompanyMapper.updateArcLabourCompany(arcLabourCompany);
    }

    /**
     * 批量删除施工单位
     *
     * @param ids 需要删除的施工单位主键
     * @return 结果
     */
    @Override
    public int deleteArcLabourCompanyByIds(String ids) {
        return arcLabourCompanyMapper.deleteArcLabourCompanyByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除施工单位信息
     *
     * @param id 施工单位主键
     * @return 结果
     */
    @Override
    public int deleteArcLabourCompanyById(Long id) {
        return arcLabourCompanyMapper.deleteArcLabourCompanyById(id);
    }

    @Override
    public ArcLabourCompany selectArcLabourCompanyByName(String companyName) {
        return arcLabourCompanyMapper.selectArcLabourCompanyByName(companyName);
    }
}
